echo off
rem 生成 IMyrpc cpp client代码脚本
set sh_folder=%~dp0
rem 删除最后的 '\'
set sh_folder=%sh_folder:~0,-1%
pushd "%sh_folder%"
set OUT_FOLDER=%sh_folder%\src\client\stub
:: 指定thrift compiler位置
set THRIFT_EXE=thrift
%THRIFT_EXE% --version || exit /B
	
:gen
if exist "%OUT_FOLDER%" (
	del  "%OUT_FOLDER%"\IMyrpc_types.* >nul 2>nul
	del  "%OUT_FOLDER%"\IMyrpc.* >nul 2>nul
	del  "%OUT_FOLDER%"\IMyrpc_constants.* >nul 2>nul
	)
if not exist "%OUT_FOLDER%" mkdir  "%OUT_FOLDER%"

%THRIFT_EXE% --gen cpp:no_skeleton,moveable_types,templates ^
	-out "%OUT_FOLDER%" ^
	%sh_folder%\..\myrpc-service\IMyrpc.thrift || exit /B

%THRIFT_EXE% --version

popd
